<?php
header("content-type: application/json");

$img_src = "images/ramon.jpg";
$imgbinary = fread(fopen($img_src, "r"), filesize($img_src));
$img_str = base64_encode($imgbinary);

$img_src2 = "images/yoda.jpg";
$imgbinary2 = fread(fopen($img_src, "r"), filesize($img_src2));
$img_str2 = base64_encode($imgbinary2);



// Create a generic object.
// Assign it the properties of id (optional - id of target HTML element, from URL)
// and 'message' - the feedback message we want the user to see.
$rtnjsonobj->src = 'data:image/jpg;base64,'.$img_str;
$rtnjsonobj->message = "You got an AJAX response via JSONP from another site!";

// Wrap and write a JSON-formatted object with a function call, using the supplied value of parm 'callback' in the URL:
echo $_GET['callback'].'('. json_encode($rtnjsonobj) . ')';  




?>